package com.zhike.service.serviceimpl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zhike.mapper.EquipmentMapper;
import com.zhike.model.Equipment;
import com.zhike.service.EquipmentService;
import com.zhike.util.DataSourceEnum;
import com.zhike.util.DataSourceHolder;
import com.zhike.util.JsonUtil;
@Service
public class EquipmentServiceImpl implements EquipmentService {

	@Resource
	EquipmentMapper equipmentMapper;

	@Override
	public String equipmentList(Equipment equipment) {
		DataSourceHolder.setDataSources(DataSourceEnum.DS1.getKey());
		JsonUtil js = new JsonUtil();
		List<Equipment> list = new ArrayList<>();
		list = equipmentMapper.equipmentList(equipment);
		js.setList(list);
		return js.getJson();
	}

	@Override
	public String equipmentRecordList(Equipment equipment) {
		DataSourceHolder.setDataSources(DataSourceEnum.DS1.getKey());
		JsonUtil js = new JsonUtil();
		List<Equipment> list = new ArrayList<>();
		list = equipmentMapper.equipmentRecordList(equipment);
		js.setList(list);
		return js.getJson();
	}
}
